package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.ClientTransferRecord;
import cn.wolfcode.crm.query.TransRecordQueryObject;
import cn.wolfcode.crm.service.IClientTransferRecordService;
import cn.wolfcode.crm.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/transferRecord")
public class ClientTransferRecordController {
    @Autowired
    private IClientTransferRecordService transferRecordService;

    @RequestMapping("/view")
    public String index() {
        return "clientTransferRecord/clientTransferRecord";
    }
    
    @RequestMapping("/query")
    @ResponseBody
    public Object query(TransRecordQueryObject qo) {
        return transferRecordService.query(qo);
    }

    @RequestMapping("/saveOrUpdate")
    @ResponseBody
    public Object saveOrUpdate(ClientTransferRecord entity) {
        try {
            transferRecordService.saveOrUpdate(entity);
        } catch (Exception ex) {
            ex.printStackTrace();
            return new JsonResult().mark(ex.getMessage());
        }
        return new JsonResult();
    }

    

}
